<!doctype html>
<html class="no-js" lang="">

<head>
  <meta charset="utf-8">
  <meta http-equiv="x-ua-compatible" content="ie=edge">
  <title></title>
  <meta name="description" content="">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

  <link rel="manifest" href="../site.webmanifest">
  <link rel="apple-touch-icon" href="../icon.png">
  <!-- Place favicon.ico in the root directory -->

  <link rel="stylesheet" href="../static/css/normalize.css">
  <link rel="stylesheet" href="../static/css/main.css">
  <link rel="stylesheet" href="../static/css/index.css">
  <link rel="stylesheet" href="../static/assets/css/zeroModal.css">
</head>

<body>
  <!--[if lte IE 9]>
    <p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="https://browsehappy.com/">upgrade your browser</a> to improve your experience and security.</p>
  <![endif]-->

  <!-- Add your site or application content here -->

  <div class="header">
    <div class="header-container">
         <div class="title" >
          <a href="../index.html"><img src="../static/img/title.png" style="height: 65px;"></a>
        </div>
      <ul class="info">
        <li id="header-username">
          <img src="../static/img/user.png" alt="">
          <a id="header-username" href="../login.html">登录</a>
        </li>
        <li>
          <img src="../static/img/config.png" alt="">
          <a href="./settings.html">设置</a>
        </li>
        <li>
          <img src="../static/img/message.png" alt="">
          <a href="./message.html">站内信</a>
        </li>
        <li>
          <a class="exit" onclick="doLogout()">退出</a>
        </li>
      </ul>
    </div>
  </div>

  <div class="main">
    <div class="container-box login">
      <div class="container-box-title">
        <img src="../static/img/title2.png" alt="">
      </div>

      <div class="title">
        <img src="../static/img/forget.png" alt="">密码找回
      </div>

      <div class="form">
        <h5>第一步</h5>
        <div class="form__item">
          <label for="">邮箱</label>
          <input type="email" name="email" id="input-email">
          <button id="submit-send-code">发送验证码</button>
        </div>

        <h5>第二步</h5>
        <div class="form__item">
          <label for="">验证码</label>
          <input type="text" name="checkCode" id="input-checkCode">
        </div>
        <div class="form__item">
          <label for="">新密码</label>
          <input type="text" name="newPassword" id="input-newPassword">
        </div>
        <div class="form__item">
          <label for="">确认新密码</label>
          <input type="text" name="repeatNewPassword" id="input-repeatNewPassword">
        </div>

      </div>

      <div class="actions">
        <button class="primary-btn" id="submit-dochange">提交</button>
         <button class="primary-btn" id="submit-goback">返回登录</button>
      </div>
    </div>

  </div>

 <div class="footer">
    <p>作者</p>
    <p>地址：</p>
    <p>邮政编码：250000 技术支持：</p>
  </div>

  <script src="../static/js/modernizr-3.6.0.min.js"></script>
  <script src="../static/js/jquery-1.12.min.js"></script>
  <script src="../static/js/plugins.js"></script>
  <script src="../../static/assets/scripts/zeroModal.min.js"></script>
  <script src="../static/js/main.js"></script>
  <script>
    document.getElementById('submit-send-code').addEventListener('click', function () {
      var inputs = document.querySelectorAll('input');

      var data = {
        email: document.getElementById('input-email').value
      }

      request({
        url: API_DOMAIN + 'culture/cultrueVerifyCode/sendEmailCheckCode',
        data: data,
        success: function (result) {
          console.log(result);
          if (result.statusCode === 200) {
            zeroModal.alert('验证码已经发送到邮箱');
          } else {
            zeroModal.error(result.message);
          }
        }
      })
    })


document.getElementById('submit-goback').addEventListener('click', function () {
	window.location.href="../login.html";
})
    document.getElementById('submit-dochange').addEventListener('click', function () {
      var inputs = document.querySelectorAll('input');

      var data = {
        email: document.getElementById('input-email').value,
        checkCode: document.getElementById('input-checkCode').value,
        newPassword: document.getElementById('input-newPassword').value,
        repeatNewPassword: document.getElementById('input-repeatNewPassword').value,
      }

      request({
        url: API_DOMAIN + 'culture/cultrueVerifyCode/checkEmailCode',
        data: data,
        success: function (result) {
          if (result.statusCode === 200) {
            zeroModal.alert('操作成功');
          } else {
            zeroModal.error(result.message);
          }
        }
      })
    })
  </script>
</body>

</html>